extends Node2D
class_name Portal

@export var portal_index: int = 0  # 传送门索引（0=第一个，1=第二个）
@export var portal: Node2D


@onready var sprite: AnimatedSprite2D = $AnimatedSprite2D
@onready var collision: CollisionShape2D = $Area2D/CollisionShape2D


func _on_area_2d_area_entered(_area: Area2D) -> void:
	_handle_player_interaction()

func _handle_player_interaction() -> void:
	# 发布传送门选择事件
	EventBus.push_event("portal_selected", [portal_index])
	
	# 视觉反馈
	if sprite:
		sprite.modulate = Color(1, 1, 0.5)  # 变黄表示已选择
	

